using AutoMapper;
using Pay.DTO;
using Pay.Data;
using Pay.IService;

namespace Pay.Service.AutoMapper
{
    public class PlayingMapper : IStartupDto
    {
        private IMapperConfigurationExpression _cfg;
        public PlayingMapper(IMapperConfigurationExpression cfg)
        {
            _cfg = cfg;
        }
        public void Execute()
        {
            Create();
        }
        protected virtual void Create()
        {
            _cfg.CreateMap<Playing, playing_dto>()
                .ForMember(dest => dest.id, src => src.MapFrom(c => c.Id))
                .ForMember(dest => dest.activity_type, src => src.MapFrom(c => c.ActivityType))
                .ForMember(dest => dest.play_type, src => src.MapFrom(c => c.PlayType))
                .ForMember(dest => dest.play_time, src => src.MapFrom(c => c.PlayTime))
                .ForMember(dest => dest.participation_end_time, src => src.MapFrom(c => c.ParticipationEndTime))
                .ForMember(dest => dest.home_team_id, src => src.MapFrom(c => c.HomeTeamId))
                .ForMember(dest => dest.guest_team_id, src => src.MapFrom(c => c.GuestTeamId))
                .ForMember(dest => dest.win_team_id, src => src.MapFrom(c => c.WinTeamId))
                .ForMember(dest => dest.home_team, src => src.MapFrom(c => c.HomeTeam))
                .ForMember(dest => dest.guest_team, src => src.MapFrom(c => c.GuestTeam))
                .ForMember(dest => dest.win_team, src => src.MapFrom(c => c.WinTeam))
                .ForMember(dest => dest.user_Guess_Playing_Hiss, src => src.MapFrom(c => c.UserGuessPlayingHiss));


            _cfg.CreateMap<playing_dto, Playing>()
                .ForMember(dest => dest.Id, src => src.MapFrom(c => c.id))
                .ForMember(dest => dest.ActivityType, src => src.MapFrom(c => c.activity_type))
                .ForMember(dest => dest.PlayType, src => src.MapFrom(c => c.play_type))
                .ForMember(dest => dest.PlayTime, src => src.MapFrom(c => c.play_time))
                .ForMember(dest => dest.ParticipationEndTime, src => src.MapFrom(c => c.participation_end_time))
                .ForMember(dest => dest.HomeTeamId, src => src.MapFrom(c => c.home_team_id))
                .ForMember(dest => dest.GuestTeamId, src => src.MapFrom(c => c.guest_team_id))
                .ForMember(dest => dest.WinTeamId, src => src.MapFrom(c => c.win_team_id))
                .ForMember(dest => dest.HomeTeam, src => src.MapFrom(c => c.home_team))
                .ForMember(dest => dest.GuestTeam, src => src.MapFrom(c => c.guest_team))
                .ForMember(dest => dest.WinTeam, src => src.MapFrom(c => c.win_team))
                .ForMember(dest => dest.UserGuessPlayingHiss, src => src.MapFrom(c => c.user_Guess_Playing_Hiss));



            _cfg.CreateMap<PlayingTeam, playing_team_dto>()
                .ForMember(dest => dest.id, src => src.MapFrom(c => c.Id))
                .ForMember(dest => dest.title, src => src.MapFrom(c => c.Title))
                .ForMember(dest => dest.img_url, src => src.MapFrom(c => c.ImgUrl))
                .ForMember(dest => dest.content, src => src.MapFrom(c => c.Content));

            _cfg.CreateMap<playing_team_dto, PlayingTeam>()
                .ForMember(dest => dest.Id, src => src.MapFrom(c => c.id))
                .ForMember(dest => dest.Title, src => src.MapFrom(c => c.title))
                .ForMember(dest => dest.ImgUrl, src => src.MapFrom(c => c.img_url))
                .ForMember(dest => dest.Content, src => src.MapFrom(c => c.content));


        }
    }
}
